<template>
	<view class="">
		<view class="">列表页面</view>
		<button @click="get">点击发送请求</button>
		<button @click="setdata">数据存储</button>
		<button @click="getdata">获取数据</button>
		<button @click="removedata">移除数据</button>
		<view class="listitem" v-for="item in listarr">
			{{item}}
		</view>
		<button type="default" @click="shuaixn">点击刷新</button>
	</view>
</template>
shuaixn
<script>
	export default{
		data(){
			return {
				listarr:['前端','JAVA','大数据','UI','1','2','3','4','5','6','7','8'],
				aa:"哈哈"
			}
		},
		methods:{
			shuaixn:function(){
				console.log("点击刷新")
				uni.startPullDownRefresh()
			},
			get:function(){
				console.log("发送请求")
				uni.request({
					url:"https://api-hmugo-web.itheima.net/api/public/v1/home/catitems",
					success(res) {
						console.log(res)
					}
				})
			},
			setdata:function(){
				uni.setStorage({
					key:'name',
					data:{
						id:1,
						name:"yt"
					},
					success() {
						console.log("存储成功")
					}
				})
			},
			getdata:function(){
				uni.getStorage({
					key:'name',
					success(res) {
						console.log("获取成功",res)
					}
				})
			},
			removedata:function(){
				uni.removeStorage({
				    key: 'name',
				    success: function (res) {
				        console.log('success');
				    }
				});
			}
		},
		onPullDownRefresh(){
			console.log("刷新了")
			setTimeout(()=>{
				this.listarr=['111大数据','UI','前端','JAVA']
				uni.stopPullDownRefresh()
			},2000)
			
		},
		onReachBottom(){
		   console.log("下拉加载")
		   this.listarr=[...this.listarr,'小可爱']
		}
	}
</script>

<style>
	.listitem{
		width: 100%;
		height: 200rpx;
	}
</style>
